<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - ged.info - /home/jkbs/src/zpr/imageeditor/gil/flattened_view.hpp</title>
  <link rel="stylesheet" type="text/css" href="../../../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../../../../../../index.html">directory</a> - <a href="index.html">home/jkbs/src/zpr/imageeditor/gil</a> - flattened_view.hpp</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>ged.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2009-06-09</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">6</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">100.0 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">6</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : #ifndef GIL_FLATTENED_VIEW_HPP
<span class="lineNum">       2 </span>                : #define GIL_FLATTENED_VIEW_HPP
<span class="lineNum">       3 </span>                : 
<span class="lineNum">       4 </span>                : #include &lt;stdexcept&gt;
<span class="lineNum">       5 </span>                : #include &lt;boost/gil/utilities.hpp&gt;
<span class="lineNum">       6 </span>                : #include &quot;../ged/typedefs.hpp&quot;
<span class="lineNum">       7 </span>                : #include &quot;../ged/Image.hpp&quot;
<span class="lineNum">       8 </span>                : 
<span class="lineNum">       9 </span>                : namespace boost { namespace gil {
<span class="lineNum">      10 </span>                : 
<span class="lineNum">      11 </span>                : //! Operator &quot;mniejszy niż&quot; dla klasy point2&lt;&gt;
<span class="lineNum">      12 </span>                : template &lt;typename T&gt; inline
<span class="lineNum">      13 </span><span class="lineCov">              2 : bool operator&lt;(const point2&lt;T&gt;&amp; p1, const point2&lt;T&gt;&amp; p2) { return (p1.x &lt; p2.x &amp;&amp; p1.y &lt; p2.y); }</span>
<span class="lineNum">      14 </span>                : 
<span class="lineNum">      15 </span>                : //! Operator &quot;mniejszy niż lub równy&quot; dla klasy point2&lt;&gt;
<span class="lineNum">      16 </span>                : template &lt;typename T&gt; inline
<span class="lineNum">      17 </span>                : bool operator&lt;=(const point2&lt;T&gt;&amp; p1, const point2&lt;T&gt;&amp; p2) { return (p1.x &lt;= p2.x &amp;&amp; p1.y &lt;= p2.y); }
<span class="lineNum">      18 </span>                : 
<span class="lineNum">      19 </span>                : //! Operator &quot;większy niż&quot; dla klasy point2&lt;&gt;
<span class="lineNum">      20 </span>                : template &lt;typename T&gt; inline
<span class="lineNum">      21 </span>                : bool operator&gt;(const point2&lt;T&gt;&amp; p1, const point2&lt;T&gt;&amp; p2) { return (p1.x &gt; p2.x &amp;&amp; p1.y &gt; p2.y); }
<span class="lineNum">      22 </span>                : 
<span class="lineNum">      23 </span>                : //! Operator &quot;większy niż lub równy&quot; dla klasy point2&lt;&gt;
<span class="lineNum">      24 </span>                : template &lt;typename T&gt; inline
<span class="lineNum">      25 </span>                : bool operator&gt;=(const point2&lt;T&gt;&amp; p1, const point2&lt;T&gt;&amp; p2) { return (p1.x &gt;= p2.x &amp;&amp; p1.y &gt;= p2.y); }
<span class="lineNum">      26 </span>                : 
<span class="lineNum">      27 </span>                : //! Funktor zwracający wartość piksela w spłaszczonym widoku
<span class="lineNum">      28 </span>                : /*!
<span class="lineNum">      29 </span>                :  * Modeluje koncept GIL PixelDereferenceAdaptorConcept
<span class="lineNum">      30 </span>                :  */
<span class="lineNum">      31 </span>                : template &lt;typename View, typename Container&gt;
<span class="lineNum">      32 </span>                : class flatten_deref_fn {
<span class="lineNum">      33 </span>                : public:
<span class="lineNum">      34 </span>                :         typedef point2&lt;std::ptrdiff_t&gt; point_t;
<span class="lineNum">      35 </span>                : 
<span class="lineNum">      36 </span>                :         typedef flatten_deref_fn const_t;
<span class="lineNum">      37 </span>                :         typedef typename View::value_type value_type;
<span class="lineNum">      38 </span>                :         typedef value_type reference;
<span class="lineNum">      39 </span>                :         typedef const value_type&amp; const_reference;
<span class="lineNum">      40 </span>                :         typedef point_t argument_type;
<span class="lineNum">      41 </span>                :         typedef reference result_type;
<span class="lineNum">      42 </span>                :         BOOST_STATIC_CONSTANT(bool, is_mutable=false);
<span class="lineNum">      43 </span>                : 
<span class="lineNum">      44 </span><span class="lineCov">              2 :         flatten_deref_fn()</span>
<span class="lineNum">      45 </span><span class="lineCov">              2 :                 : layers_(0L) {}</span>
<span class="lineNum">      46 </span><span class="lineCov">              2 :         flatten_deref_fn(const Container* layers)</span>
<span class="lineNum">      47 </span><span class="lineCov">              2 :                 : layers_(layers)</span>
<span class="lineNum">      48 </span><span class="lineCov">              2 :         { }</span>
<span class="lineNum">      49 </span>                : 
<span class="lineNum">      50 </span>                :         //! Operator umożliwiający dostęp do wartości piksela w
<span class="lineNum">      51 </span>                :         //! spłaszczonym widoku
<span class="lineNum">      52 </span>                :         /*!
<span class="lineNum">      53 </span>                :          * \param p współrzędne odczytywanego punktu
<span class="lineNum">      54 </span>                :          * \return wartość piksela w odczytywanym punkcie
<span class="lineNum">      55 </span>                :          */
<span class="lineNum">      56 </span>                :         result_type operator()(point_t p) const
<span class="lineNum">      57 </span>                :         {
<span class="lineNum">      58 </span>                :                 // Przesunięcie początku układu współrzędnych do
<span class="lineNum">      59 </span>                :                 // lewego górnego rogu warstwy tła
<span class="lineNum">      60 </span>                :                 typename Container::value_type bg_layer = *layers_-&gt;begin();
<span class="lineNum">      61 </span>                :                 p += bg_layer-&gt;getOffset();
<span class="lineNum">      62 </span>                : 
<span class="lineNum">      63 </span>                :                 // Poszukiwanie najwyżej położonej warstwy, do której
<span class="lineNum">      64 </span>                :                 // należy dany punkt
<span class="lineNum">      65 </span>                :                 typename Container::const_reverse_iterator it;
<span class="lineNum">      66 </span>                :                 for (it = layers_-&gt;rbegin(); it != layers_-&gt;rend(); ++it) {
<span class="lineNum">      67 </span>                :                         typename Container::value_type layer = *it;
<span class="lineNum">      68 </span>                :                         point_t offset = layer-&gt;getOffset();
<span class="lineNum">      69 </span>                :                         point_t dims = layer-&gt;getDimensions();
<span class="lineNum">      70 </span>                : 
<span class="lineNum">      71 </span>                :                         if (p &gt;= offset &amp;&amp; p &lt; offset + dims) {
<span class="lineNum">      72 </span>                :                                 return (*layer)(p - offset);
<span class="lineNum">      73 </span>                :                         }
<span class="lineNum">      74 </span>                :                 }
<span class="lineNum">      75 </span>                : 
<span class="lineNum">      76 </span>                :                 // Błąd - odczyt pozycji poza widokiem
<span class="lineNum">      77 </span>                :                 throw std::out_of_range(&quot;flatten_deref_fn::operator()&quot;);
<span class="lineNum">      78 </span>                :         }
<span class="lineNum">      79 </span>                : 
<span class="lineNum">      80 </span>                : private:
<span class="lineNum">      81 </span>                :         //! Wskaźnik na stos warstw
<span class="lineNum">      82 </span>                :         const Container* layers_;
<span class="lineNum">      83 </span>                : };
<span class="lineNum">      84 </span>                : 
<span class="lineNum">      85 </span>                : } } // namespace boost::gil
<span class="lineNum">      86 </span>                : 
<span class="lineNum">      87 </span>                : #endif  // GIL_FLATTEN_VIEW_HPP
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
